package ar.edu.utn.frsf.cidisi.ginet.diagram.agim.graphicalextensions;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.emf.ecore.EClass;
import org.pnml.tools.epnk.gmf.extensions.graphics.GraphicalExtension;
import org.pnml.tools.epnk.gmf.extensions.graphics.IUpdateableFigure;
import org.pnml.tools.epnk.gmf.extensions.graphics.figures.ArcFigure;
import org.pnml.tools.epnk.helpers.NetFunctions;
import org.pnml.tools.epnk.pnmlcoremodel.Place;
import org.pnml.tools.epnk.pnmlcoremodel.RefPlace;
import org.pnml.tools.epnk.pnmlcoremodel.Transition;

import ar.edu.utn.frsf.cidisi.ginet.abstractginet.AbstractGINetType;
import ar.edu.utn.frsf.cidisi.ginet.abstractginet.AbstractginetPackage;
import ar.edu.utn.frsf.cidisi.ginet.abstractginet.Arc;
import ar.edu.utn.frsf.cidisi.ginet.diagram.agim.graphicalextensions.figures.ArcAgimFigure;
import ar.edu.utn.frsf.cidisi.ginet.diagram.agim.graphicalextensions.figures.PlaceAgimFigure;
import ar.edu.utn.frsf.cidisi.ginet.diagram.agim.graphicalextensions.figures.RefPlaceAgimFigure;
import ar.edu.utn.frsf.cidisi.ginet.diagram.agim.graphicalextensions.figures.TransitionAgimFigure;

/**
 *  
 * @generated NOT (manually created class)
 * @author jmr
 *
 */
public class AgimGraphicalExtension extends GraphicalExtension {

	/**
	 * 
	 */
	@Override
	public List<EClass> getExtendedNetTypes() {
		ArrayList<EClass> list = new ArrayList<EClass>();
		list.add(AbstractginetPackage.eINSTANCE.getAbstractGINetType());
		return list;
	}

	/**
	 * 
	 * 
	 */
	@Override
	public List<EClass> getExtendedNetObjects(EClass netType) {
		ArrayList<EClass> list = new ArrayList<EClass>();
		if (netType.equals(AbstractginetPackage.eINSTANCE.getAbstractGINetType())) {
			list.add(AbstractginetPackage.eINSTANCE.getArc());
			list.add(AbstractginetPackage.eINSTANCE.getTransition());
			list.add(AbstractginetPackage.eINSTANCE.getPlace());
			list.add(AbstractginetPackage.eINSTANCE.getRefPlace());
		}
		return list;
	}


	/**
	 * Returns the specific ArcTypeFigure for arcs of the ArcType net type.
	 */
	@Override
	public ArcFigure createArcFigure(org.pnml.tools.epnk.pnmlcoremodel.Arc arc) {
		if (arc instanceof Arc) {
			return new ArcAgimFigure((Arc) arc);
		}
		return null;
	}

	/**
	 *
	 * 
	 */
	@Override
	public IUpdateableFigure createPlaceFigure(Place place) {
		if (NetFunctions.getPetriNetType(place) instanceof AbstractGINetType) {
			return new PlaceAgimFigure(place);
		}
		return null;
	}

	/**
	 * 
	 * 
	 */
	@Override
	public IUpdateableFigure createTransitionFigure(Transition transition) {
		if (NetFunctions.getPetriNetType(transition) instanceof AbstractGINetType) {
			return new TransitionAgimFigure(transition);
		}
		return null;
	}


	/**
	 * 
	 * 
	 */
//	@Override
	public IUpdateableFigure createRefPlaceFigure(RefPlace refPlace) {
		if (NetFunctions.getPetriNetType(refPlace) instanceof AbstractGINetType) {
			return new RefPlaceAgimFigure(refPlace);
		}
		return null;
	}

}
